package com.example.demo.service;

import com.example.demo.entity.two.Department;
import com.example.demo.repository.two.DepartmentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 落羽 on 2017/8/29.
 */
@Service
public class OrganizationService {
    @Autowired
    DepartmentRepository departmentRepository;

    public List<Department> getDepartmentListByParentId(int id) {
        return this.departmentRepository.findByDepartFidOrderBySortAsc(id);
    }
    public List<Department> getAllDepartmentByLevel(int level) {
        return this.departmentRepository.findByDepartFidOrderBySortAsc(level);
    }
}
